/**
 * Created by Administrator on 2019/5/22.
 */
var arr = [98, 31, 5, 27, 2, 78];
for(var i =0; i<arr.length-1;i++){
    for(var k=0; k<arr.length-1-i;k++){
        if(arr[k]>arr[k+1]){
            var t = arr[k];
            arr[k] = arr[k+1];
            arr[k+1] = t;
        }
    }
}console.log(arr);